package Thread;

/**
 * Created by sunwei on 2017/9/30
 * Time:14:42
 */
public class Main3 {
    public static void main(String[] args) {
        System.out.println(Thread.currentThread().getName()+"主线程运行开始");
        ThreadDemo3 mth1 = new ThreadDemo3("A");
        ThreadDemo3 mth2 = new ThreadDemo3("B");
        mth1.start();
        mth2.start();
        try {
            mth1.join();//加入join后，主线程一定会等到mth1运行结束后才能结束
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName()+"主线程运行结束");
    }
}
